package com.weipu.common.facade.model;

import org.json.JSONObject;

import com.weipu.common.constants.ServerConstant;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;

public class OrderStatusModel implements Parcelable {
	private int PendingPayment;

	private int PendingDelivery;

	private int FullShipment;

	private int AllCount;

	public int getPendingPayment() {
		return PendingPayment;
	}

	public void setPendingPayment(int pendingPayment) {
		PendingPayment = pendingPayment;
	}

	public int getPendingDelivery() {
		return PendingDelivery;
	}

	public void setPendingDelivery(int pendingDelivery) {
		PendingDelivery = pendingDelivery;
	}

	public int getFullShipment() {
		return FullShipment;
	}

	public void setFullShipment(int fullShipment) {
		FullShipment = fullShipment;
	}

	public int getAllCount() {
		return AllCount;
	}

	public void setAllCount(int allCount) {
		AllCount = allCount;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel parcel, int arg1) {
		parcel.writeInt(PendingPayment);
		parcel.writeInt(PendingDelivery);
		parcel.writeInt(FullShipment);
		parcel.writeInt(AllCount);
	}

	public static final Parcelable.Creator<OrderStatusModel> CREATOR = new Creator<OrderStatusModel>() {

		@Override
		public OrderStatusModel[] newArray(int size) {
			// TODO Auto-generated method stub
			return new OrderStatusModel[size];
		}

		@Override
		public OrderStatusModel createFromParcel(Parcel source) {
			// TODO Auto-generated method stub
			return new OrderStatusModel(source);
		}
	};

	@SuppressWarnings("unchecked")
	public OrderStatusModel(Parcel source) {
		PendingPayment = source.readInt();
		PendingDelivery = source.readInt();
		FullShipment = source.readInt();
		AllCount = source.readInt();
	}

	public OrderStatusModel() {
	}

	public static OrderStatusModel jsonObject(JSONObject JObject) {
		OrderStatusModel orderStatus = new OrderStatusModel();
		if (null != JObject) {
			orderStatus
					.setPendingPayment(JObject
							.optInt(ServerConstant.OrderStatus.CONSTANT_PENDINGPAYMENT));
			orderStatus
					.setPendingDelivery(JObject
							.optInt(ServerConstant.OrderStatus.CONSTANT_PENDINGDELIVERY));
			orderStatus.setFullShipment(JObject
					.optInt(ServerConstant.OrderStatus.CONSTANT_FULLSHIPMENT));
			orderStatus.setAllCount(JObject
					.optInt(ServerConstant.OrderStatus.CONSTANT_ALLCOUNT));
		}
		return orderStatus;
	}

}
